package com.firebird.app.kotlin.stock.net

import com.firebird.app.kotlin.stock.data.*
import com.firebird.app.kotlin.stock.data.AccountBean
import com.firebird.app.kotlin.stock.data.AllocationManageBean
import com.firebird.app.kotlin.stock.data.BankData
import com.firebird.app.kotlin.stock.data.BankListBean
import com.firebird.app.kotlin.stock.data.ClearBean
import com.firebird.app.kotlin.stock.data.DepositParmasBean
import com.firebird.app.kotlin.stock.data.DetailsDealBean
import com.firebird.app.kotlin.stock.data.LoginBean
import com.firebird.app.kotlin.stock.data.MoneyRuleBean
import com.firebird.app.kotlin.stock.data.MultipleRuleBean
import com.firebird.app.kotlin.stock.data.OrderListBean
import com.firebird.app.kotlin.stock.data.ProfitBean
import com.firebird.app.kotlin.stock.data.RechargeOffLineBean
import com.firebird.app.kotlin.stock.data.RechargeOnLineBean
import com.firebird.app.kotlin.stock.data.RunningListBean
import com.firebird.app.kotlin.stock.data.RunningTypeBean
import com.firebird.app.kotlin.stock.data.SimpleBean
import com.firebird.app.kotlin.stock.data.StockBean
import com.firebird.app.kotlin.stock.data.VerifyPersonBean
import com.firebird.app.kotlin.stock.data.WechatBean
import io.reactivex.Flowable
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query


/**
 * Create by zhenglei on 2019/06/17
 */
interface APIService {
    //获取验证码
    @POST(baseUrl + "debtor/registryGetCode")
    fun getCodeData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //用户注册
    @POST(baseUrl + "debtor/registry")
    fun getRegistData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //登录
    @POST(baseUrl + "debtor/login")
    fun getLoginData(@Body body: RequestBody?): Call<LoginBean?>?

    //密码找回获取验证码
    @POST(baseUrl + "debtor/forgetPwd")
    fun getForgetPwdCode(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //验证验证码（未登录）
    @POST(baseUrl + "debtor/checkCodeOffLine")
    fun getVerityCodeNoLogin(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //获取验证码（登录）
    @POST(baseUrl + "debtor/getCode")
    fun getVerCodeIsLogin(@Body body: RequestBody?): Call<SimpleBean?>?

    //验证验证码（登录）
    @POST(baseUrl + "debtor/checkCodeOnLine")
    fun getVerityCodeIsLogin(@Body body: RequestBody?): Call<SimpleBean?>?

    //修改登录密码（未登录）
    @POST(baseUrl + "debtor/updatePwdOffLine")
    fun getUpdatePwdNoLoginData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //修改登录密码（登录）
    @POST(baseUrl + "debtor/updatePwdOnLine")
    fun getUpdatePwdIsLoginData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //退出登录
    @POST(baseUrl + "debtor/quit")
    fun getLogoutData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //账户个人中心
    @POST(baseUrl + "debtor/userInfo")
    fun getAccountData(@Body body: RequestBody?): Call<AccountBean?>?

    //实名认证
    @POST(baseUrl + "debtor/attestation")
    fun getVerifyPersonData(@Body body: RequestBody?): Call<VerifyPersonBean?>?

    //银行卡列表
    @POST(baseUrl + "debtorBank/bankCardList")
    fun getBankListData(@Body body: RequestBody?): Call<BankListBean?>?

    //卡号获取银行
    @POST(baseUrl + "debtorBank/getBankName")
    fun getBankData(@Body body: RequestBody?): Call<BankData?>?

    //绑定银行卡
    @POST(baseUrl + "debtorBank/bind")
    fun getBindBankData(@Body body: RequestBody?): Flowable<SimpleBean?>?

    //设置交易密码
    @POST(baseUrl + "debtor/updateTranPwd")
    fun getDealPwdData(@Body body: RequestBody?): Call<SimpleBean?>?

    //解绑银行卡
    @POST(baseUrl + "debtorBank/unBind")
    fun getUnBindBankData(@Body body: RequestBody?): Call<SimpleBean?>?

    //资金流水类型
    @get:POST(baseUrl + "debtorBank/busiTypes")
    val runningTypeData: Call<Any?>?

    //资金流水列表
    @POST(baseUrl + "debtorBank/fundFlow")
    fun getRunningListData(@Body body: RequestBody?): Call<RunningListBean?>?

    //配资管理列表
    @GET(baseUrl + "bpOrder/findBpOrderList")
    fun getAllocationManageListData(@Query("bpStatus") bpStatus: String?,
                                    @Query("bpType") bpType: String?,
                                    @Query("currentPage") currentPage: String?,
                                    @Query("itemsPerPage") itemsPerPage: String?): Call<AllocationManageBean?>?

    //追加保证金
    @GET(baseUrl + "bpOrder/addBpOrderGuaranteeAmt")
    fun getAddCashData(@Query("bpOrderId") bpOrderId: Int,
                       @Query("money") money: String?): Call<SimpleBean?>?

    //终止交易
    @GET(baseUrl + "bpOrder/terminateBpOrder")
    fun getOverDealData(@Query("bpOrderId") bpOrderId: Int): Call<SimpleBean?>?

    //去交易详情
    @POST(baseUrl + "bpOrder/bpOrderDetail")
    fun getDetailsDealData(@Body body: RequestBody?): Call<DetailsDealBean?>?

    //配资金额规则查询
    @GET(baseUrl + "bpOrder/findBpSetList")
    fun getMoneyRuleData(@Query("bpType") bpType: Int): Call<MoneyRuleBean?>?

    //配资杠杆规则查询
    @GET(baseUrl + "bpOrder/finBbpList")
    fun getMultipleRuleData(@Query("bpType") bpType: Int): Call<MultipleRuleBean?>?

    //申请配资
    @GET(baseUrl + "bpOrder/saveBpOrder")
    fun getSubmitAllocationData(@Query("guaranteeAmt") guaranteeAmt: String?,
                                @Query("bpId") bpId: Int,
                                @Query("times") times: Int,
                                @Query("bpType") bpType: Int,
                                @Query("singleRate") singleRate: String?,
                                @Query("bpAround") bpAround: Int,
                                @Query("bpTimeType") bpTimeType: Int): Call<SimpleBean?>?

    //提现界面参数
    @POST(baseUrl + "transOrder/withdrawParam")
    fun getDepositParmasData(@Body body: RequestBody?): Call<DepositParmasBean?>?

    //提现(线上)  withdrawOffLineAddOrder线下
    @POST(baseUrl + "transOrder/withdrawOnLineAddOrder")
    fun getDepositData(@Body body: RequestBody?): Call<SimpleBean?>?

    //股票查询信息
    @GET(baseUrl + "comOrder/findQuoteList")
    fun getStockData(@Query("sharesCode") sharesCode: String?,
                     @Query("bpOrderId") bpOrderId: Int): Flowable<StockBean?>?

    //可提盈查询
    @GET(baseUrl + "comOrder/findProfit")
    fun getProfitData(@Query("bpOrderId") bpOrderId: Int): Call<ProfitBean?>?

    //提盈
    @GET(baseUrl + "comOrder/saveProfit")
    fun getSubmitProfitData(@Query("bpOrderId") bpOrderId: Int,
                            @Query("profitAmt") profitAmt: String?): Call<SimpleBean?>?

    //买入股票
    @GET(baseUrl + "comOrder/tradeShareBuy")
    fun getBuyStockData(@Query("sharesCode") sharesCode: String?,
                        @Query("sharesName") sharesName: String?,
                        @Query("entrustPrice") entrustPrice: String?,
                        @Query("entrustNum") entrustNum: String?,
                        @Query("entrustProportion") entrustProportion: String?,
                        @Query("bpOrderId") bpOrderId: String?): Call<SimpleBean?>?

    //卖出股票
    @GET(baseUrl + "comOrder/tradeShareSell")
    fun getSaleStockData(@Query("sharesCode") sharesCode: String?,
                         @Query("sharesName") sharesName: String?,
                         @Query("entrustPrice") entrustPrice: String?,
                         @Query("entrustNum") entrustNum: String?,
                         @Query("entrustProportion") entrustProportion: String?,
                         @Query("bpOrderId") bpOrderId: String?,
                         @Query("bpFundsRId") bpFundsRId: String?): Call<SimpleBean?>?

    //获取订单列表  1委托撤单、2当日委托、3历史委托、 4当日成交、5历史成交
    @GET(baseUrl + "comOrder/findComOrderList")
    fun getOrderListData(@Query("dealStatus") dealStatus: Int,
                         @Query("bpOrderId") bpOrderId: Int,
                         @Query("startTime") startTime: String?,
                         @Query("endTime") endTime: String?): Call<OrderListBean?>?

    //撤单
    @GET(baseUrl + "comOrder/repealComOrder")
    fun getRecallOrderData(@Query("comOrderId") comOrderId: Int,
                           @Query("bpOrderId") bpOrderId: Int): Call<SimpleBean?>?

    //清仓查询
    @GET(baseUrl + "comOrder/getClearDebtorShares")
    fun getClearData(@Query("bpOrderId") bpOrderId: Int): Call<ClearBean?>?

    //线上转账参数
    @POST(baseUrl + "transOrder/transferOnLineAddOrder")
    fun getOnLineData(@Body body: RequestBody?): Call<RechargeOnLineBean?>?

    //线下转账参数
    @POST(baseUrl + "transOrder/transferOffLineParam")
    fun getOffLineData(@Body body: RequestBody?): Call<RechargeOffLineBean?>?

    //线下转账提交
    @POST(baseUrl + "transOrder/transferOffLineAddOrder")
    fun getOffLineSubmitData(@Body body: RequestBody?): Call<SimpleBean?>?

    //线下微信充值获取二维码
    @POST(baseUrl + "transOrder/wechatPayOffLineParam")
    fun getWeChatData(@Body body: RequestBody?): Call<WechatBean?>?

    //线下微信充值提交
    @POST(baseUrl + "transOrder/wechatPayOffLineAddOrder")
    fun getWeChatSubmitData(@Body body: RequestBody?): Call<SimpleBean?>?

    //线下支付宝充值获取二维码
    @POST(baseUrl + "transOrder/alipayOffLineParam")
    fun getAlipayData(@Body body: RequestBody?): Call<WechatBean?>?

    //线下支付宝充值提交
    @POST(baseUrl + "transOrder/alipayOffLineAddOrder")
    fun getAlipaySubmitData(@Body body: RequestBody?): Call<SimpleBean?>?

    companion object {
        const val baseUrl = "zbfunding/"
    }
}